<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="app">
        <!-- <h3>{{msg.split("").reverse().join("")}}</h3> -->
        <h3>{{ReverseMsg}}</h3>
        <input type="text" v-model="msg">

    </div>
</body>
<script>
    var vm = new Vue({
        el: "#app",
        data: {
            msg: "hello world"
        },
        computed: {
            ReverseMsg: {
                // return this.msg.split("").reverse().join("");
                get: function() {
                    return this.msg.split("").reverse().join("");
                },
                set:function(newvalue){
                    console.log(2)
                    console.log("发生改变"+newvalue)
                }
            }
        },
    })
    console.log(vm.ReverseMsg);
    vm.ReverseMsg="我真的不晓得啊";
</script>

</html>